Skip to main content

starts_with

starts_with

Description

Syntax:

BOOLEAN STARTS_WITH (VARCHAR str, VARCHAR prefix)

If the string starts with the specified prefix, this function will return true; otherwise, it will return false. If any argument is NULL, it will return NULL.

Example

MySQL [(none)]> select starts_with("hello world","hello");
+-------------------------------------+
| starts_with('hello world', 'hello') |
+-------------------------------------+
| 1 |
+-------------------------------------+

MySQL [(none)]> select starts_with("hello world","world");
+-------------------------------------+
| starts_with('hello world', 'world') |
+-------------------------------------+
| 0 |
+-------------------------------------+

Keywords

STARTS_WITH